<extend name="_layout/main"/>
<block name="head">
    <style>
        .lianmeng .top ul li {
            width: 24.9%;
        }

        .lianmeng .bottom .content .list, .sjfenlei .bottom .content .list {
            width: 100%;
        }
    </style>
</block>
<block name="top">
    <header class="mui-bar mui-bar-nav" id="header">
        <a class="btn btn1 slide-menu" href="{:U('/index')}">
            <
        </a>
        <div class="top-sch-box flex-col">
            <form name="s-form" action="{:U('search')}">
                <div class="centerflex">
                    <i class="fdj iconfont icon-sousuo"></i>
                    <input type="text" name="keyword" id="keyword" value="{$Think.request.keyword}" class="sch-txt"
                           placeholder="输入您要搜索的活动"/>
                </div>
            </form>
        </div>
        <a class="btn btn1" href="javascript:;">
            <label id="city"></label>
        </a>
    </header>
</block>
<block name="content">
    <div class="warp warpthree clearfloat">
        <div class="lianmeng clearfloat">
            <div class="top clearfloat">
                <ul>
                    <volist name="industry" id="item">
                        <li>
                            <a href="{:U('lst', ['industry'=>$item['id']])}">
                                <img src="{$item.icon}"/>
                                <p>{$item.name}</p>
                            </a>
                        </li>
                    </volist>
                </ul>
            </div>
            <div class="middle clearfloat">
                <volist name="actives" id="item" offset="0" length="1">
                    <a href="{:U('detail', ['id'=>$item['id']])}">
                        <div class="left clearfloat fl">
                            <p class="tit box-s over">{$item.activity_name}</p>
                            <p class="fu-tit box-s over">{$item.industry_name}</p>
                            <img src="{$item.thumb}" style="width: 90%; margin-left: 5%;"/>
                        </div>
                    </a>
                </volist>
                <div class="right clearfloat fr">
                    <volist name="actives" id="item" offset="1" length="2">
                        <a href="{:U('detail', ['id'=>$item['id']])}">
                            <div class="shang clearfloat">
                                <div class="zuo clearfloat fl">
                                    <p class="tit box-s over">{$item.industry_name}</p>
                                    <p class="fu-tit box-s over">{$item.activity_name}</p>
                                </div>
                                <div class="tu clearfloat fr">
                                    <img src="{$item.thumb}" style="padding-top: 10px; padding-right: 5px;"/>
                                </div>
                            </div>
                        </a>
                    </volist>
                </div>
            </div>
            <div class="bottom clearfloat">
                <a href="{:U('supps')}"><p class="tit box-s">联盟商家</p></a>
                <div class="content clearfloat box-s">
                    <volist name="suppliers" id="item">
                        <div class="list clearfloat fl">
                            <a href="{:U('lst',['sid'=>$item['user_id']])}">
                                <div class="tu clearfloat fl ra5">
                                    <span></span>
                                    <img src="{$item.avatar|default='/Public/static/img/touxiang.png'}"/>
                                </div>
                                <div class="nr clearfloat fr">
                                    <p class="bt over">{$item.supplier_name}</p>
                                    <p class="fu-tit">{$item.introduce|stripslashes}</p>
                                </div>
                            </a>
                        </div>

                    </volist>

                </div>
            </div>
        </div>
    </div>
</block>
<block name="scripts">
    <script src="http://api.map.baidu.com/api?v=1.3" type="text/javascript"></script>
    <script>
        if (window.navigator.geolocation) {
            var options = {
                enableHighAccuracy: true,
            };
            window.navigator.geolocation.getCurrentPosition(handleSuccess, handleError, options);
        } else {
            alert("浏览器不支持html5来获取地理位置信息");
        }

        function handleSuccess(position) {
            // 获取到当前位置经纬度  本例中是chrome浏览器取到的是google地图中的经纬度
            var lng = position.coords.longitude;
            var lat = position.coords.latitude;
            // 调用百度地图api显示
            var map = new BMap.Map("map");
            var ggPoint = new BMap.Point(lng, lat);

            var gc = new BMap.Geocoder();
            gc.getLocation(ggPoint, function (rs) {
                var addComp = rs.addressComponents;
                $("#city").html(addComp.city);
                if (addComp.city != '') {
                    $.post("{:U('Location/set_city')}", {city: addComp.city}, function () {

                    }, 'json');
                }
                //console.log(addComp.province + ", " + addComp.city + ", " + addComp.district + ", " + addComp.street + ", " + addComp.streetNumber);
            });

        }

        function handleError(error) {

        }
    </script>
</block>
